-- background: 2742 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 0 -- name: -- part 3 (field) -- low flags: 84 -- high flags: 0000 -- rect: left=28 top=13 right=98 bottom=228 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: temp -- part 2 (field) -- low flags: 05 -- high flags: 0000 -- rect: left=0 top=113 right=128 bottom=256 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 20 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: copyright -- part 4 (field) -- low flags: 84 -- high flags: 0007 -- rect: left=28 top=24 right=109 bottom=228 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: temp2 -- part 1 (button) -- low flags: 00 -- high flags: A003 -- rect: left=78 top=33 right=55 bottom=178 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 16383 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Sort It! ----- HyperTalk script ----- on mouseUp do srtList end mouseUp on srtList put empty into bg field "temp" put empty into bg field "temp2" answer file "Choose a Bookmark file to sort." of type "TEXT" put the result into resultCode -- if you cancel if resultCode is empty -- everything's fine then put it into bookmark -- then put the path into bookmark variable else exit srtList ask file "Give the sorted file a name." with "Sorted (" & the date & ")" put the result into resultCode -- if you cancel if resultCode is empty -- everything's fine then put it into sorted -- then put the path into sorted variable else exit srtList open file bookmark read from file bookmark until end put it into bg field "temp" do theWork open file sorted write bg field "temp" to file sorted close file bookmark close file sorted beep 3 end srtList on theWork put 1 into lCount repeat set cursor to busy find string "" in bg field "temp" if the result is not empty then exit repeat put the foundChunk into tempFound2 put word 2 of tempFound1 into charNum put word 4 of tempFound2 into charNum2 put char charNum to charNum2 of bg field "temp" into line lCount of bg field "temp2" delete char charNum to charNum2 of bg field "temp" add 1 to lCount end repeat put 1 into lCount put empty into bg field "temp" repeat set cursor to busy find string "ADD_DATE=" in bg field "temp2" if the result is not empty then exit repeat put the foundChunk into tempFound1 put the foundLine into tempLine find string quote & ">" in bg field "temp2" if the result is not empty then exit repeat put the foundChunk into tempFound2 put word 2 of tempFound1 into charNum put word 4 of tempFound2 into charNum2 subtract 1 from charNum2 delete char charNum to charNum2 of bg field "temp2" put word 2 of tempLine into LineNum put line lineNum of bg field "temp2" into line lCount of bg field "temp" add 1 to lCount end repeat sort lines of bg field "temp" by word 3 of each end theWork